#求数列第n项
def nxiang(n,x = 0,y = 1,z = 1,w = 1):
    if 1 <= n <= 2:
        return w
    else:
        w = x + y + z
        n -= 1
        x = y
        y = z
        z = w
        return nxiang(n,x,y,z,w)
n = int(input("请输入求第几项："))
print("第{}项为{}".format(n,nxiang(n)))